<template>
    <bi-form ref="form">
        <bi-form-item label="名称">
            <bi-input type="text" v-model="form.title" placeholder="请输入名称" required  />
        </bi-form-item>
        <bi-form-item label="图片" v-if="image">
            <bi-file image preview-type="square" v-model="form.image" required></bi-file>
        </bi-form-item>
    </bi-form>
</template>

<script>
export default{
    dialog:{
        title:'设置型号值',
        width:500
    },
    data(){

        let form = {
            title:'',
            image:''
        }
        
        this.$assign(form,this.item);

        return {
            form
        }
    },
    props:{
        item:Object,
        image:{
            type:Boolean,
            default:false
        }
    },
    methods:{
        dialogOk(){
            if (this.$refs.form.check()){
                if (this.dialog.callback(this.form)){
                    this.dialog.close();
                }
            }
            return false;
        }
    }
}
</script>